package org.gap.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */
@IdClass(org.gap.domain.EtablissementsBancairesPK.class)
@Entity
@NamedQueries({
		@NamedQuery(name = "findAllEtablissementsBancairess", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbCodeEtablissNouveau", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbCodeEtablissNouveau = ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbCodeSituation", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbCodeSituation = ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbCodeSituationContaining", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbCodeSituation like ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateDebutValidite", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateDebutValidite = ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateDebutValiditeAfter", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateDebutValidite > ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateDebutValiditeBefore", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateDebutValidite < ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateDisparition", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateDisparition = ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateDisparitionAfter", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateDisparition > ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateDisparitionBefore", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateDisparition < ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateEffetIdInvariant", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateEffetIdInvariant = ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateEffetIdInvariantAfter", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateEffetIdInvariant > ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateEffetIdInvariantBefore", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateEffetIdInvariant < ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateFinValidite", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateFinValidite = ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateFinValiditeAfter", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateFinValidite > ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDateFinValiditeBefore", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDateFinValidite < ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDescription", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDescription = ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbDescriptionContaining", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbDescription like ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbEtablissement", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbEtablissement = ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbOptionIdInvariant", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbOptionIdInvariant = ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbOptionIdInvariantContaining", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbOptionIdInvariant like ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbPays", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbPays = ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByEtbPaysContaining", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbPays like ?1"),
		@NamedQuery(name = "findEtablissementsBancairesByPrimaryKey", query = "select myEtablissementsBancaires from EtablissementsBancaires myEtablissementsBancaires where myEtablissementsBancaires.etbPays = ?1 and myEtablissementsBancaires.etbEtablissement = ?2") })
@Table(schema = "GAP", name = "ETABLISSEMENTS_BANCAIRES")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "GAP_v2/org/gap/domain", name = "EtablissementsBancaires")
@XmlRootElement(namespace = "GAP_v2/org/gap/domain")
public class EtablissementsBancaires implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "ETB_PAYS", length = 3, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String etbPays;
	/**
	 */

	@Column(name = "ETB_ETABLISSEMENT", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer etbEtablissement;
	/**
	 */

	@Column(name = "ETB_DESCRIPTION", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String etbDescription;
	/**
	 */

	@Column(name = "ETB_CODE_SITUATION", length = 1, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String etbCodeSituation;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "ETB_DATE_DEBUT_VALIDITE")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar etbDateDebutValidite;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "ETB_DATE_FIN_VALIDITE")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar etbDateFinValidite;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "ETB_DATE_DISPARITION")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar etbDateDisparition;
	/**
	 */

	@Column(name = "ETB_CODE_ETABLISS_NOUVEAU", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Integer etbCodeEtablissNouveau;
	/**
	 */

	@Column(name = "ETB_OPTION_ID_INVARIANT", length = 1, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String etbOptionIdInvariant;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "ETB_DATE_EFFET_ID_INVARIANT")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar etbDateEffetIdInvariant;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "ETB_PAYS", referencedColumnName = "PPP_PAYS", nullable = false, insertable = false, updatable = false) })
	@XmlTransient
	Pays pays;
	/**
	 */
	@OneToMany(mappedBy = "etablissementsBancaires", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<org.gap.domain.Guichets> guichetses;

	/**
	 */
	public void setEtbPays(String etbPays) {
		this.etbPays = etbPays;
	}

	/**
	 */
	public String getEtbPays() {
		return this.etbPays;
	}

	/**
	 */
	public void setEtbEtablissement(Integer etbEtablissement) {
		this.etbEtablissement = etbEtablissement;
	}

	/**
	 */
	public Integer getEtbEtablissement() {
		return this.etbEtablissement;
	}

	/**
	 */
	public void setEtbDescription(String etbDescription) {
		this.etbDescription = etbDescription;
	}

	/**
	 */
	public String getEtbDescription() {
		return this.etbDescription;
	}

	/**
	 */
	public void setEtbCodeSituation(String etbCodeSituation) {
		this.etbCodeSituation = etbCodeSituation;
	}

	/**
	 */
	public String getEtbCodeSituation() {
		return this.etbCodeSituation;
	}

	/**
	 */
	public void setEtbDateDebutValidite(Calendar etbDateDebutValidite) {
		this.etbDateDebutValidite = etbDateDebutValidite;
	}

	/**
	 */
	public Calendar getEtbDateDebutValidite() {
		return this.etbDateDebutValidite;
	}

	/**
	 */
	public void setEtbDateFinValidite(Calendar etbDateFinValidite) {
		this.etbDateFinValidite = etbDateFinValidite;
	}

	/**
	 */
	public Calendar getEtbDateFinValidite() {
		return this.etbDateFinValidite;
	}

	/**
	 */
	public void setEtbDateDisparition(Calendar etbDateDisparition) {
		this.etbDateDisparition = etbDateDisparition;
	}

	/**
	 */
	public Calendar getEtbDateDisparition() {
		return this.etbDateDisparition;
	}

	/**
	 */
	public void setEtbCodeEtablissNouveau(Integer etbCodeEtablissNouveau) {
		this.etbCodeEtablissNouveau = etbCodeEtablissNouveau;
	}

	/**
	 */
	public Integer getEtbCodeEtablissNouveau() {
		return this.etbCodeEtablissNouveau;
	}

	/**
	 */
	public void setEtbOptionIdInvariant(String etbOptionIdInvariant) {
		this.etbOptionIdInvariant = etbOptionIdInvariant;
	}

	/**
	 */
	public String getEtbOptionIdInvariant() {
		return this.etbOptionIdInvariant;
	}

	/**
	 */
	public void setEtbDateEffetIdInvariant(Calendar etbDateEffetIdInvariant) {
		this.etbDateEffetIdInvariant = etbDateEffetIdInvariant;
	}

	/**
	 */
	public Calendar getEtbDateEffetIdInvariant() {
		return this.etbDateEffetIdInvariant;
	}

	/**
	 */
	public void setPays(Pays pays) {
		this.pays = pays;
	}

	/**
	 */
	public Pays getPays() {
		return pays;
	}

	/**
	 */
	public void setGuichetses(Set<Guichets> guichetses) {
		this.guichetses = guichetses;
	}

	/**
	 */
	public Set<Guichets> getGuichetses() {
		if (guichetses == null) {
			guichetses = new java.util.LinkedHashSet<org.gap.domain.Guichets>();
		}
		return guichetses;
	}

	/**
	 */
	public EtablissementsBancaires() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(EtablissementsBancaires that) {
		setEtbPays(that.getEtbPays());
		setEtbEtablissement(that.getEtbEtablissement());
		setEtbDescription(that.getEtbDescription());
		setEtbCodeSituation(that.getEtbCodeSituation());
		setEtbDateDebutValidite(that.getEtbDateDebutValidite());
		setEtbDateFinValidite(that.getEtbDateFinValidite());
		setEtbDateDisparition(that.getEtbDateDisparition());
		setEtbCodeEtablissNouveau(that.getEtbCodeEtablissNouveau());
		setEtbOptionIdInvariant(that.getEtbOptionIdInvariant());
		setEtbDateEffetIdInvariant(that.getEtbDateEffetIdInvariant());
		setPays(that.getPays());
		setGuichetses(new java.util.LinkedHashSet<org.gap.domain.Guichets>(that.getGuichetses()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("etbPays=[").append(etbPays).append("] ");
		buffer.append("etbEtablissement=[").append(etbEtablissement).append("] ");
		buffer.append("etbDescription=[").append(etbDescription).append("] ");
		buffer.append("etbCodeSituation=[").append(etbCodeSituation).append("] ");
		buffer.append("etbDateDebutValidite=[").append(etbDateDebutValidite).append("] ");
		buffer.append("etbDateFinValidite=[").append(etbDateFinValidite).append("] ");
		buffer.append("etbDateDisparition=[").append(etbDateDisparition).append("] ");
		buffer.append("etbCodeEtablissNouveau=[").append(etbCodeEtablissNouveau).append("] ");
		buffer.append("etbOptionIdInvariant=[").append(etbOptionIdInvariant).append("] ");
		buffer.append("etbDateEffetIdInvariant=[").append(etbDateEffetIdInvariant).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((etbPays == null) ? 0 : etbPays.hashCode()));
		result = (int) (prime * result + ((etbEtablissement == null) ? 0 : etbEtablissement.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof EtablissementsBancaires))
			return false;
		EtablissementsBancaires equalCheck = (EtablissementsBancaires) obj;
		if ((etbPays == null && equalCheck.etbPays != null) || (etbPays != null && equalCheck.etbPays == null))
			return false;
		if (etbPays != null && !etbPays.equals(equalCheck.etbPays))
			return false;
		if ((etbEtablissement == null && equalCheck.etbEtablissement != null) || (etbEtablissement != null && equalCheck.etbEtablissement == null))
			return false;
		if (etbEtablissement != null && !etbEtablissement.equals(equalCheck.etbEtablissement))
			return false;
		return true;
	}
}
